package T5_yield;
public class T5_yield {
	public static void main(String[] args) {
			Thread thread = new Thread(new MyThread2("lang1"));
			thread.setPriority(1);
			thread.start();
			
			Thread thread2 = new Thread(new MyThread2("lang2"));
			thread2.setPriority(4);
			thread2.start();
			
			Thread thread3 = new Thread(new MyThread("lang3"));
			thread3.setPriority(8);
			thread3.start();
		
	}
}
class MyThread implements Runnable {    
    private String name;    
    public MyThread(String name) {    
        this.name = name;    
    }    
    public void run() {    
        for (int i = 0; i < 10; i++) { 
        	System.out.println(name + ": " + i);   
        }    
    }    
} 

class MyThread2 implements Runnable {    
    private String name;    
    public MyThread2(String name) {    
        this.name = name;    
    }    
    public void run() {    
        for (int i = 0; i < 10; i++) { 
        	System.out.println(name + ": " + i);   
        	if(i >3 ){
        		Thread.yield();
        		System.out.println("yield"+i);
        	}
        }    
    }    
} 

